﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EachRecord.Common.Attributes
{
    [AttributeUsage(AttributeTargets.All,AllowMultiple = true,Inherited = true)]
    public class MasterAttribute:Attribute
    {
        private int min_length=0;
        private int max_length=0;
        private bool isnull=false;
        private bool isLogin=false;

        /// <summary>
        /// 判断属性长度是否合法
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public virtual string ValidateLength(string args) {
             throw new NotImplementedException();
        }

        /// <summary>
        /// 判断属性长度以及是否可以为null
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public virtual string ValidateLengthAndNull(string args) {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 判断是否可以为null
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public virtual string ValidateIsNull(string args) { 
             throw new NotImplementedException();
        }

        /// <summary>
        /// 判断是否已经登录然后放行执行
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public virtual bool ValidateLogin() {
           return RedisUtils.Instance().GetValue("loginInfo").Length>0;
        }
    }
}
